import { createStore, createLogger } from 'vuex'
import createPersistedState from 'vuex-persistedstate'
import category from './modules/category'
// 导入子模块
import user from './modules/user'
import cart from './modules/cart'
export default createStore({
  state: {
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    user,
    cart,
    category
  },
  /**
   * vuex-persistedstate插件使用说明：
   * 1. 默认集成之后存储所有数据
   * 2. 可以通过配置指定存储的key和存储哪些数据=》{ key: 'rabbit-131', paths: ['user', 'cart'] }
   */
  plugins: [createPersistedState({ key: 'rabbit-131', paths: ['user', 'cart'] }), createLogger()]
})
